package com.hci.leukemiaapp;

import android.app.Activity;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TimePicker;
import android.widget.Toast;

public class PillEdit extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.pill_edit);
        
        Button confirmButton = (Button) findViewById(R.id.confirm);
        confirmButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                setResult(RESULT_OK);
                finish();
            }
        });
        
        Button cancelButton = (Button) findViewById(R.id.cancel);
        cancelButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                setResult(RESULT_CANCELED);
                finish();
            }
        });
    }
    
    public void alert1Change(View v){
    	showDialog(1);
    }
    
    public void alert2Change(View v){
    	showDialog(2);
    }
    
    public void alert3Change(View v){
    	showDialog(3);
    }
    
    private TimePickerDialog.OnTimeSetListener mTimeSetListener =
        new TimePickerDialog.OnTimeSetListener() {
            public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
            	Toast.makeText(PillEdit.this, "Time Changed", Toast.LENGTH_SHORT).show();
            }
        };
        
    @Override
    protected Dialog onCreateDialog(int id) {
        switch (id) {
        case 1:
            return new TimePickerDialog(this, mTimeSetListener, 8, 30, false);
        case 2:
        	return new TimePickerDialog(this, mTimeSetListener, 0, 0, false);
        case 3:
        	return new TimePickerDialog(this, mTimeSetListener, 0, 0, false);
        }
        return null;
    }
}